<template>
    <el-dialog title="审核详情" :visible.sync="show" width="70%" :lock-scroll="true" height="800px">
        <el-table :data="dataList" style="width: 100%">
            <el-table-column prop="name" label="审核节点" align="center">

                <template slot-scope="scope">
                    {{ scope.row.Scope }}
                </template>
            </el-table-column>
            <el-table-column prop="type" label="审核人" align="center">
                <template slot-scope="scope">
                    {{ scope.row.CreatorAppUserDto.Name }}
                </template>
            </el-table-column>
            <el-table-column prop="type" label="审核状态" align="center">
                <template slot-scope="scope">
                    <el-tag v-if="scope.row.AuditStatus == 1" type="success">{{ scope.row.AuditStatusFormat }}</el-tag>
                    <el-tag v-if="scope.row.AuditStatus == 2" type="danger">{{ scope.row.AuditStatusFormat }}</el-tag>
                </template>
            </el-table-column>
            <el-table-column prop="type" label="审核备注" align="center">
                <template slot-scope="scope">
                    {{ scope.row.AuditRemark }}
                </template>
            </el-table-column>
            <el-table-column prop="type" label="审核时间" align="center">
                <template slot-scope="scope">
                    {{ scope.row.CreationTime }}
                </template>
            </el-table-column>
        </el-table>
    </el-dialog>
</template>

<script>
import store from '@/store';
import { number } from 'echarts';
import { mapGetters } from 'vuex'
export default {
    name: "AuditStatusRecordList",
    computed: {
        ...mapGetters([
            'name', 'roleTypeFormat', 'avatar', 'userId', 'loginTimePeriod', "user", 'userId', 'roleType'
        ])
    },

    data() {

        return {
            lock: 0,//用来防止重复提交的变量
            searchForm: {},//搜索定义的数据对象
            dataColum: [
                {
                    key: "Id",
                    hidden: true,

                },
                {
                    key: "AuditStatus",
                    title: "审核状态",
                    type: store.getters.columnType.SHORTTEXT,
                },
                {
                    key: "Scope",
                    title: "节点",
                    type: store.getters.columnType.SHORTTEXT,
                },
                {
                    key: "AuditUserId",
                    hidden: true,
                },
                {
                    key: "AuditUserDto.Name",
                    title: "审核人",
                    type: store.getters.columnType.SHORTTEXT,
                },
                {
                    key: "Type",
                    title: "类型",
                    type: store.getters.columnType.SHORTTEXT,
                },
                {
                    key: "AuditRemark",
                    title: "审核备注",
                    type: store.getters.columnType.SHORTTEXT,
                },
                {
                    key: "RelativeId",
                    hidden: true,
                },
                {
                    key: "RelativeDto.Name",
                    title: "关联记录",
                    type: store.getters.columnType.SHORTTEXT,
                },
                {
                    title: "菜单功能",
                    width: "300px",
                    type: store.getters.columnType.USERDEFINED,
                },
            ],
            editModalFormRules: {
                "AuditStatus": [
                ],

                "Scope": [
                    { required: true, message: '该项为必填项', trigger: 'blur' },
                ],

                "AuditUserId": [
                ],

                "Type": [
                    { required: true, message: '该项为必填项', trigger: 'blur' },
                ],

                "AuditRemark": [
                    { required: true, message: '该项为必填项', trigger: 'blur' },
                ],

                "RelativeId": [
                ],

            },
            formData: {

            },//保存或者修改定义的数据对象
            show: false,
            dataList: [],

        };
    },
    created() {

    },
    methods: {
        async Show(RelativeId, Type) {
            
            let { Data: { Items } } = await this.$Post(`/AuditStatusRecord/List`, { RelativeId: RelativeId, Type: Type });
            this.dataList = Items;
            this.show = true;
        },
        async AddRecord(RelativeId,Type,AuditRemark,AuditStatus,Scope){
             await this.$Post(`/AuditStatusRecord/CreateOrEdit`, {
                RelativeId:RelativeId,
                Type:Type,
                AuditStatus:AuditStatus,    
                AuditRemark:AuditRemark,
                Scope:Scope
             });
        }


    },
};
</script>
